import request from '@neu/biz-core/utils/request'
const baseUrl = 'dcom/api/w/act/workorders'
const formBaseUrl = 'dcom/api/w/act/models'
export const page = (params) => {
  return request({
    url: baseUrl + '/me/p',
    params,
    method: 'get'
  })
}

export const todoPage = (params) => {
  return request({
    url: baseUrl + '/todo/p',
    params,
    method: 'get'
  })
}

export const donePage = (params) => {
  return request({
    url: baseUrl + '/down/p',
    params,
    method: 'get'
  })
}

export const revoke = (workNum) => {
  return request({
    url: baseUrl + '/' + workNum + '/revoke',
    method: 'post'
  })
}

export const remove = (workNum) => {
  return request({
    url: baseUrl + '/' + workNum,
    method: 'delete'
  })
}

export const records = (workNum) => {
  return request({
    url: baseUrl + '/records/' + workNum,
    method: 'get'
  })
}

export const startForm = (workOrderType) => {
  return request({
    url: formBaseUrl + '/startform/' + workOrderType,
    method: 'get'
  })
}

export const process = (workNum) => {
  return request({
    url: baseUrl + '/' + workNum + '/image/run',
    method: 'get',
    responseType: 'blob'
  })
}

export const all = (params) => {
  return request({
    url: baseUrl + '/p',
    params,
    method: 'get'
  })
}
